/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package uk.ac.cam.can;

import java.io.BufferedWriter;
import java.io.FileWriter;
import java.util.Random;

/**
 *
 * @author Thomas
 */
public class RandomSet {
    private static Random rand = new Random();
    private static String[] postcode = {"CB58BL", "CB58WC", "CB58CD", "CB38AC", "CB38AD", "CB38AA"};
    private static String[] gender = {"Male", "Female"};
    private static String[] cancer = {"None", "Lungs", "Skin", "Bones", "Breast", "Leukaemia", "Stomac", "Brain Tumour", "Pancreas"};
    private static String[] diabte = {"None", "Type A", "Type B"};
    
    public static void generate(String filename, int entries) throws Exception{
        BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter(filename));
        try{
            for(int i = 0; i < entries; i++){
                String age = ""+(rand.nextInt(90)+1);
                String pc = postcode[rand.nextInt(postcode.length)];
                String gn = gender[rand.nextInt(gender.length)];
                String weight = ""+rand.nextInt(120);
                String cnc = cancer[rand.nextInt(cancer.length)];
                String dbt = diabte[rand.nextInt(diabte.length)];
                
                bufferedWriter.write(age+";"+pc+";"+gn+";"+weight+";"+cnc+";"+dbt);
                bufferedWriter.newLine();
            }
        }finally{
            bufferedWriter.flush();
            bufferedWriter.close();
        }
    }
}
